<?php
/**
 * Created By PhpStorm
 * User: 星洛尘--Stara_Rs
 * Date: 2019/10/9
 * Time: 21:59
 */


namespace app\api\validate;


use think\Validate;

class IDMustBePostiveInt extends BaseValidate
{
    protected $rule = [
        'id'=> 'require|isPostiveInteger',
    ];

    protected function isPostiveInteger($value, $rule='', $data='', $filed='')
    {
        if (is_numeric($value) && is_int($value + 0) && ($value + 0)>0) {
            return true;
        } else {
            return $filed."必须时正整数";
        }
    }
}